Use the ConvertXmlToJson activity
The ConvertXmlToJson activity can be used to convert an XML (Extensible Markup Language) value into a JSON (JavaScript Object Notation) value.
The ConvertXmlToJson activity is located in the XML/Json section of the Tribal Toolbox.
This activity contains the following relevant properties.
| Section | This field | Holds this information... |
|---|---|---|
| Inputs | InputObject | The XML object to convert. |
| Misc | DisplayName |
The title of the activity. Important.The DisplayName property is set to ConvertXmlToJson by default.
|
| Outputs | OutputString | The converted JSON representation of the object. |
Selecting the ellipsis button adjacent to the relevant field opens the Expression Editor, where you can enter the relevant code in the Visual Basic (VB) format.
To use the ConvertXmlToJson activity in a workflow:
-
Select the Tribal Toolbox tab in the XML/Json section of Workflow Builder .
-
Drag and drop the ConvertXmlToJson activity into the desired location within the Sequence panel. In this example, ConvertXmlToJson is followed by TrackingMessageActivity so that the output can be viewed.
-
Enter values for the InputObject (for example: xmlObj) and OutputObject (for example: jsonObj) fields and add a name for the activity to the DisplayName field. Select the ellipsis button adjacent to the relevant fields to open the Expression Editor.
Important.An exclamation mark symbol indicates a warning. Refer to Use the Warnings Panel for further information. -
Enter values for TrackingMessageActivity fields, Key (for example: "json") and TrackingMessage (for example: jsonObj.ToString()) fields and add a name for the activity to the DisplayName field.
-
Select Save .
You can now trigger the workflow and use the User Tracking tab to ensure that the XML string is converted to a JSON object.